package com.aqielife.demo.listener;



import com.aqielife.demo.entity.User;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import static com.aqielife.demo.MQConstant.QUEUE_WORK;

/**
 * @author aqie
 * @date 2022/02/06 16:54
 * @desc
 */
@Component
@Slf4j
public class WorkReceiveListener {
  /**
   *
   * @param user
   * @param channel 通道信息
   * @param message 附加的参数信息
   */
  @RabbitListener(queues =  QUEUE_WORK)
  public void receiveMessage(User user, Channel channel, Message message) {
    // 只包含发送的消息
    log.info("接收到消息：{} {} {}",  user, channel, message);
  }

}
